<?php
namespace Home\Controller;
use Home\Model\StudentService;
use Think\Controller;

class StuSettingsController extends HomeController{
    //---------------------------------学生更改基本信息-------------------------------------
    public function info(){
        $stu_sql = new StudentService();
        $stu_field = array("stu_id","stu_number","stu_name","stu_email","col_id","sex");
        $info = $stu_sql->getInfo($stu_field);
        $this->assign("info",$info);
        $this->display();
    }
    //---------------------------------跳转到修改密码的界面---------------------------------
    public function change_pwd(){
        $this->display();
    }
    //---------------------------------学生更改基本信息-------------------------------------
    public function update_stu_info(){
        if(IS_AJAX) {       //需要stu_name sex
            $stu_sql = new StudentService();
            $data = $stu_sql->updateStudent();
            $this->ajaxReturn($data);
        }
    }
    //---------------------------------学生更改密码-------------------------------------
    public function update_stu_pwd(){
        if(IS_AJAX) {           //需要old_pwd   new_pwd
            $stu_sql = new StudentService();
            $data = $stu_sql->updatePWD();
            $this->ajaxReturn($data);
        }
    }
}